<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('厂家余额变动明细列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <input id="factoryId" name="factoryId" th:value="*{factoryId}" type="hidden">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>充值类别：</label>
                                <select id="factoryClassify" name="factoryClassify" th:with="type=${@dict.getType('factory_classify')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <label>充值类型：</label>
                                <select id="factoryType" name="factoryType" th:with="type=${@dict.getType('factory_type')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <!--<div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="zsyh:factoryBalanceDetails:add">
                    <i class="fa fa-plus"></i> 添加
                </a>
                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="zsyh:factoryBalanceDetails:edit">
                    <i class="fa fa-edit"></i> 修改
                </a>
                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="zsyh:factoryBalanceDetails:remove">
                    <i class="fa fa-remove"></i> 删除
                </a>
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="zsyh:factoryBalanceDetails:export">
                    <i class="fa fa-download"></i> 导出
                </a>
            </div>-->
            <div class="col-sm-12 select-table table-bordered">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('zsyh:factoryBalanceDetails:edit')}]];
        var removeFlag = [[${@permission.hasPermi('zsyh:factoryBalanceDetails:remove')}]];
        var factoryClassifyDatas = [[${@dict.getType('factory_classify')}]];
        var factoryTypeDatas = [[${@dict.getType('factory_type')}]];
        var prefix = ctx + "zsyh/factoryBalanceDetails";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                showSearch: false,
                showRefresh: false,
                showToggle: false,
                showColumns: false,
                sidePagination: "server",
                pagination: true,
                paginationLoop: false,
                pageSize: 5,
                pageNumber: 1,
                queryParams : function (params) {
                    return{
                        factoryId: $("#factoryId").val(),
                        factoryClassify: $("#factoryClassify option:selected").val(),
                        factoryType: $("#factoryType option:selected").val(),
                        offset: params.offset,
                        pageNum: params.offset/5+1,
                        pageSize: 5
                    }
                },
                modalName: "厂家余额变动明细",
                columns: [{
                    field : 'Number',
                    title : '序号',
                    align: 'center',
                    width: 20,
                    formatter : function(value, row, index) {
                        var pageSize = $('#bootstrap-table').bootstrapTable('getOptions').pageSize;//通过表的#id 可以得到每页多少条
                        var pageNumber = $('#bootstrap-table').bootstrapTable('getOptions').pageNumber;//通过表的#id 可以得到当前第几页
                        return pageSize * (pageNumber - 1) + index + 1;//返回每条的序号： 每页条数 * （当前页 - 1 ）+ 序号
                    }
                },
                {
                    field: 'id',
                    title: '余额详情id',
                    align: 'center',
                    visible: false
                },
                    {
                        field: 'createTime',
                        align: 'center',
                        title: '充值时间'
                    },
                {
                    field: 'factoryMoney',
                    align: 'center',
                    title: '充值金额'
                },
                {
                    field: 'factoryClassify',
                    align: 'center',
                    title: '充值类别',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(factoryClassifyDatas, value);
                    }
                },
                {
                    field: 'factoryType',
                    align: 'center',
                    title: '充值类型',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(factoryTypeDatas, value);
                    }
                }
                    ]
            };
            $.table.init(options);
        });
    </script>
</body>
</html>